
const cloud = require('wx-server-sdk')
cloud.init({
    env: cloud.DYNAMIC_CURRENT_ENV
})
const db = cloud.database();

exports.main = async (event, context) => {
    const wxContext = cloud.getWXContext()

    const result = await db.collection('repair_tabel').add({
        data: {
            _openid: wxContext.OPENID,
            compute_type: event.compute_type,
            compute_name: event.compute_name,
            reason: event.reason,
            submit_time: event.submit_time,
            order_time: event.order_time,
            imgList: event.imgList,
            state: -1,
            _createTime: Date.now(),
            _updateTime: Date.now(),
        }
    })

    return {
        result: result,
    }
}